home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 14 / hacker14.iso / programacao / visual / perl.exe / {app} / UnMapIP.pl < prev    next >
Encoding:
Text File  |  2003-01-11  |  515 b   |  24 lines

  1. exit if (not defined($ARGV[1]));
  2. $hosts = $ARGV[1];
  3.  
  4. open(HOSTS,"$hosts");
  5. @lines = <HOSTS>;
  6. close HOSTS;
  7.  
  8. open(HOSTS,">$hosts");
  9.  
  10. foreach (@lines) {
  11.  $ismap = (~/^([\d\.]+)\s+(\S+)/);
  12.  # lines look like 
  13.  # 127.0.0.1       www.mysite.com 
  14.  
  15.  if (($ismap and ($2 ne $ARGV[0])) or (not ($ismap)))  { 
  16.   # if the pattern that fits the line is found and is NOT the
  17.   # line we want to remove OR the pattern is not found (could be a comment)
  18.   # print the line.
  19.   print HOSTS;
  20.  }
  21. }
  22.  
  23. close HOSTS;
  24.